<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .v-enter-from,.v-leave-to {
            opacity: 0;
            transform:translateY(30px);
        }
        .v-enter-active,.v-leave-active {
            transition: all 0.5s;
        }
        .v-leave-active {
            position: absolute;
        }
        .v-move {
            transition: all 0.5s;
        }
        .v-enter-to,.v-leave-from {
            opacity: 1;
            transform:translateY(0);
        }
        .span-item {
            display: inline-block;
            margin-right: 20px;
        }
    </style>
</head>
<body>
    <div id="root"></div>
    <script src="./vue3基础源码/vue3.js"></script>
    <script>
        const app = Vue.createApp({
            data(){
                return {
                    list:[3,2,1],
                }
            },
            methods:{
                handleClick(){
                    this.list.unshift(this.list.length + 1);
                },
                handleDelClick(){
                    this.list.shift();
                }
            },
            template:`
                        <transition-group>
                            <span class="span-item" v-for="item in list" :key="item">{{item}}</span>
                        </transition-group>
                        <button @click="handleClick">添加</button>
                        <button @click="handleDelClick">删除</button>

                        `
        });

        app.mount("#root");
    </script>
</body>
</html>